import { App, Config, Configuration } from '@midwayjs/decorator';
import * as typegoose from '@midwayjs/typegoose';
import { ILifeCycle } from '@midwayjs/core';
import { Application } from 'egg';
import { join } from 'path';
import {setGlobalOptions, Severity} from '@typegoose/typegoose';

setGlobalOptions({options: {allowMixed: Severity.ALLOW}});
@Configuration({
  imports: [typegoose],
  importConfigs: [join(__dirname, './config')],
  conflictCheck: true,
})
export class ContainerLifeCycle implements ILifeCycle {
  @App()
  app: Application;

  @Config()
  bodyParser

  async onReady() {
    this.bodyParser.formLimit = '100mb';
    this.bodyParser.jsonLimit = '100mb';
  }
}
